{% extends 'base.html' %}

{% block title %}{{ term.term_name }}{% endblock %}

{% block content %}
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .header {
            margin-top: 3%;
        }

        /* 侧边导航样式 */
        .side-nav {
            position: fixed;
            left: 20px;
            top: 50%;
            transform: translateY(-50%);
            background: white;
            border-radius: 8px;
            padding: 20px 15px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            z-index: 100;
        }

        .nav-item {
            display: block;
            color: #333;
            text-decoration: none;
            padding: 12px 25px;
            margin: 8px 0;
            position: relative;
            transition: all 0.3s;
        }

        /* 学术地位特殊样式 */
        #academic-status-link {
            font-weight: bold;
            font-size: 1.1em;
        }

        /* 悬停效果 */
        .nav-item:hover::after {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 50%;
            transform: translateX(-50%);
            width: 60%;
            height: 2px;
            background: #8A2BE2;
        }

        .nav-bar {
            position: fixed;
            top: 0;
            width: 100%;
            height: 10%;
            background: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 40px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            z-index: 1000;
        }

        .logo-section {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .logo-image {
            max-height: 70px;
            width: auto;
        }

        .search-container {
            display: flex;
            align-items: center;
            width: 50%;
            margin-left: 5%;
        }

        .search-input {
            flex-grow: 1;
            height: 55px;
            padding: 8px 16px;
            border: none;
            /* 移除所有边框 */
            border-bottom: 2px solid #524eef;
            /* 仅保留底部黑线 */
            border-radius: 0;
            /* 去除圆角 */
            background: transparent;
            /* 透明背景 */
            font-size: 20px;
            outline: none;
            transition: all 0.3s;
        }

        .search-input:focus {
            border-color: #524eef;
        }

        .search-button {
            background: none;
            border: none;
            cursor: pointer;
            padding: 8px;
            display: flex;
            align-items: center;
        }

        .search-button i {
            color: #6a1b9a;
            font-size: 30px;
            margin-left: 20px;
        }

        .search-button:hover i {
            color: #9c27b0;
        }

        .main-content {
            /* banner高度+20px缓冲 */
            max-width: 1400px;
            margin: 10% auto;
            padding: 0 10% 20% 20%;
            margin-top: 100px;
            margin-bottom: 0;
        }

        .grade-indicator-1 {
            display: flex;
            max-width: 300px;
            border-radius: 20px;
            /* 圆角半径 */
            background: linear-gradient(to right, #524eef 40%, white 30%);
            /* 蓝白分割背景 */
            border: 1px solid #000;
            /* 整体黑色外框 */
            margin-top: 1%;
            margin-bottom: 2%;
        }

        .grade-indicator-2 {
            display: flex;
            max-width: 500px;
            border-radius: 20px;
            /* 圆角半径 */
            background: linear-gradient(to right, #524eef 24%, white 10%);
            /* 蓝白分割背景 */
            border: 1px solid #000;
            /* 整体黑色外框 */
            margin-top: 1%;
            margin-bottom: 2%;
        }

        .label-tag-1 {
            flex: 0 0 40%;
            padding: 10px;
            color: white;
            text-align: center;
            font-size: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-right: 1px solid #000;
            font-weight: bold;
            /* 增加右侧分隔线 */
        }

        .label-tag-2 {
            flex: 0 0 24%;
            padding: 10px;
            color: white;
            text-align: center;
            font-size: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-right: 1px solid #000;
            font-weight: bold;
            /* 增加右侧分隔线 */
        }

        .grade-content {
            flex: 1;
            padding: 10px 30px;
            font-size: 18px;
            color: #333;
        }

        /* 核心样式 */
        .metric-container {
            max-width: 680px;
            padding-top: 2%;
            margin-bottom: 5%;
        }

        .header-group {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
        }

        .serial-box {
            width: 32px;
            height: 32px;

            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            color: #8A2BE2;
        }

        .metric-title {
            color: #524eef;
            font-size: 20px;
        }

        .progress-system {
            max-width: 600px;
            margin: 20px auto;
        }

        .progress-track {
            height: 12px;
            background: #f0f0f0;
            border-radius: 6px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: #524eef;
            transition: width 0.3s ease;
            width: 50%;
            /*这里控制常用词串的进度条 */
        }

        .serial {
            width: 36px;
            height: 36px;
            border: 2px solid #8A2BE2;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            color: #8A2BE2;
            margin-right: 1rem;
        }

        .function-content {
            line-height: 1.6;
            color: #333;
        }

        .core-definition {
            padding-left: 5%;
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 1%;
        }

        .term {
            margin-bottom: 1%;
            padding-left: 5%;
            position: relative;
        }

        .usage-examples {
            margin-top: 1.5rem;
            padding-top: 1rem;
            border-top: 1px dashed #9f9a9a;
        }

        .example-list {
            list-style: none;
            padding-left: 1.5rem;
            color: #666;
            font-style: italic;
        }

        .example-list li {
            margin: 0.4rem 0;
            position: relative;
        }

        .example-list li::before {
            content: "▹";
            color: #524eef;
            position: absolute;
            left: -1.2rem;
        }

        /* 数字标尺系统 */
        .number-scale {
            display: flex;
            justify-content: space-between;
            margin-top: 15px;
            position: relative;
        }

        .number-scale span {
            width: 40px;
            text-align: center;
            position: relative;
        }

        /* 整体容器 */
        .definition-system {
            margin: 2rem auto;
            background: #FFF;
            border-radius: 8px;
        }

        /* 标签导航 */
        .definition-tabs {
            display: flex;
            gap: 20px;
            margin-bottom: 1.5rem;

        }

        /* 标签导航 */
        .tab-nav {
            display: flex;
            gap: 15px;
            margin-bottom: 20px;

        }

        .nav-btn {
            padding: 8px 24px;
            border: none;
            border-radius: 18px;
            background: #f0f0f0;
            color: #666;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 20px;
            font-weight: bold;
        }

        /* 选项卡样式 */
        .tab-buttons {
            display: flex;
            gap: 5%;
            margin-bottom: 20px;
        }

        .tab-btn {
            padding: 15px 20px;
            font-size: 18px;
            border: none;
            border-radius: 40px;
            background: #f0f0f0;
            color: #666;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .tab-btn.active {
            background: #524eef;
            color: white;
            box-shadow: 0 2px 6px rgba(43, 101, 236, 0.2);
        }

        /* 内容容器 */
        .content-group {
            display: none;
        }

        .content-group.active {
            display: block;
        }

        /* 内容区块 */
        .content-block {
            display: flex;
            gap: 15px;
            margin-bottom: 20px;
            padding: 15px;
            background: #f8f9fa;
            border-radius: 8px;
        }

        .index-badge {
            flex: 0 0 32px;
            height: 32px;
            background: #524eef;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 500;
        }

        .content-title {
            color: #524eef;
            margin: 0 0 8px;
            font-size: 16px;
        }

        .dark-text {
            color: #333;
            line-height: 1.6;
            margin: 0;
        }

        .example-container {
            margin: 0 auto;
        }

        .title-box {
            background: #524eef;
            border-radius: 40px;
            padding: 12px 30px;
            display: inline-block;
            margin-bottom: 20px;
            color: #FFF;
            font-size: 18px;
        }

        .example-list {
            padding-left: 0;
            font-style: normal;
        }

        .example-item {
            margin-bottom: 15px;
            line-height: 1.5;
            display: flex;
            align-items: start;
        }

        .example-num {
            font-weight: bold;
            margin-right: 15px;
        }

        .like-container {
            margin: 0 auto;
        }

        .title-box {
            background: #524eef;
            border-radius: 40px;
            padding: 12px 30px;
            display: inline-block;
            margin-bottom: 20px;
            color: #FFF;
            font-size: 18px;
        }

        .like-list {
            padding-left: 0;
            font-style: normal;
        }

        .like-item {
            margin-bottom: 15px;
            line-height: 1.5;
            display: flex;
            align-items: start;
        }

        .like-num {
            font-weight: bold;
            margin-right: 15px;
        }
        .collect-btn {
            padding: 12px 30px;
            border: none;
            border-radius: 40px;
            color: white;
            background: #524eef;
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
            transition: a11 0.3s ease;
            box-shadow: 0 2px 6px rgba(43, 101, 236, 0.2);
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
    </style>
    <div class="main-content">
        
        <h1>{{ term.term_name }}</h1>
        <!-- 所属等级 -->
        <div class="header">
           
           
            <div class="header">
                <div class="grade-indicator-2">
                    {%if  term.term_fieli is not none%}
                    
                    <div class="label-tag-2">所属学科</div>
                    <div class="grade-content">{{ term.term_field }}</div>
                    {%endif%}
                   
                </div>
            </div>
        </div>
        
        <!--语义透明度 -->
        <div class="metric-container">
            <div class="header-group">
                {%if  term.term_field is not None%}
                <div class="serial-box"></div>
                <h3 class="metric-title">语义透明度</h3>
                {%endif%}
                {%if  term.term_field is  None%}
                <div class="serial-box"></div>
                <h3 class="metric-title">相对频次</h3>
                {%endif%}
            </div>
            <!-- 分级进度条系统 -->
            <div class="progress-system">
                <!-- 进度条主体 -->
                <div class="progress-track">
                <!-- 使用 semantic_transparency 变量设置进度条填充宽度 -->
                <div class="progress-fill" style="width: {{ semantic_transparency }}%"></div>
                </div>
                <div class="number-scale">
                    <span>1</span>
                    <span>2</span>
                    <span>3</span>
                    <span>4</span>
                    <span>5</span>
                </div>
            </div>

        </div>
       
        <!-- 专业释义&通用释义 -->
        <div class="tab-buttons" id="definition">
            {%if  term.term_field is not None%}
            <button class="tab-btn active" data-target="pro-content">专业释义</button>
            {%endif%}
            {%if  term.term_field is  None%}
            <button class="tab-btn active" data-target="pro-content">功能</button>
                
            {%endif%}
            
            {% if term.has_focus is not None %}
            <button class="tab-btn" data-target="gen-content">通用释义</button>
        {% endif %}
            
        </div>
        <div class="content-container">
            <!-- 专业释义内容组 -->
            <div id="pro-content" class="content-group active">
                
                <div class="content-block">
                    <div class="index-badge">1</div>
                    <div class="text-content">
                        {%if  term.term_field is not None%}
                        <h3 class="content-title">专业表达方式</h3>
                        {%endif%}
                        {%if  term.term_field is  None%}
                        <h3 class="content-title">功能</h3>
                        {%endif%}
                        
                        <p>{{ term.term_introduction }}</p>
                    </div>
                </div>
            </div>
            {% if term.has_focus is not None %}
            
            <div id="gen-content" class="content-group">
                <div class="content-block">
                    <div class="index-badge">1</div>
                    <div class="text-content">
                        <h3 class="content-title">通用表达方式</h3>
                        <p class="dark-text">{{ term.has_focus }}</p>
                    </div>
                </div>
            </div>
        {% endif %}<!-- 通用释义内容组 -->
            
        </div>
        <!-- 例句 -->
        <div class="example-container" id="examples">
            <div class="title-box">
                <span>例句</span>
            </div>

            <div class="example-list">
                <div class="example-item">
                    <ul>
                        {% for example in examples %}
                            <li>{{ example }}</li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
        </div>
        <!-- 将收藏按钮移到例句下方 -->
        {% if user.is_authenticated %}
        <div class="text-center mt-4">
            <a href="{% url 'collect_term' term_id=term.id %}" class="btn btn-primary">
                <button class="collect-btn">收藏</button>
            </a>
        </div>
        <!-- 将收藏按钮移到例句下方 -->
    
    {% endif %}
    </div>
   
{% endblock %}